System and method for synchronizing transient resource usage between virtual machines in a hypervisor environment

ABSTRACT

A system and method for synchronizing transient resource usage between virtual machines, e.g. Java Virtual Machines (JVMs), running within a hypervisor. In accordance with an embodiment, the system allows for synchronizing garbage collection and code optimization to reduce transient processor (cpu) and memory usage. In accordance with an embodiment, the system comprises a computer; a hypervisor for executing virtual servers running JVMs; a communication channel between the virtual servers; wherein each virtual server further comprises non-transient and transient memory and a synchronization module. In accordance with an embodiment the synchronization modules schedule garbage collects and code optimizations to minimize overlaps, thereby reducing the peak transient memory and cpu usage and the resulting volatility of transient resource usage within a computer. In accordance with another embodiment, a cloud manager can move virtual servers between computers to optimize computer volatility within a cloud.

CLAIM OF PRIORITY

This application is a continuation of U.S. Patent Application titled“SYSTEM AND METHOD FOR SYNCHRONIZING TRANSIENT RESOURCE USAGE BETWEENVIRTUAL MACHINES IN A HYPERVISOR ENVIRONMENT”, application Ser. No.12/563,440, filed Sep. 21, 2009, which application is hereinincorporated by reference.

COPYRIGHT NOTICE

A portion of the disclosure of this patent document contains materialwhich is subject to copyright protection. The copyright owner has noobjection to the facsimile reproduction by anyone of the patent documentor the patent disclosure, as it appears in the Patent and TrademarkOffice patent file or records, but otherwise reserves all copyrightrights whatsoever.

FIELD OF INVENTION

The invention is generally related to application servers and virtualmachines, and particularly to a system and method for synchronizingtransient resource usage between virtual machines (for example JVMs)running within a hypervisor.

BACKGROUND

Server virtualization using hypervisors is a valuable technique toreduce the operating costs of the server, as well as improving theenergy efficiency. A standard server with a standard operating systemand different server applications are is rarely fully used all the time.Since current server hardware do does not significantly reduce theenergy consumption when the software is idling, this will result inenergy waste. Server virtualization allows many virtual servers to runon a single physical server, and therefore the processor (cpu) cyclesand memory that were previously wasted can instead be put to use foranother virtual server. The software that makes this possible isreferred to herein as a hypervisor.

When operating systems and server applications are virtualized ontophysical hardware, a safety margin must be provided to handle thosesituations when there is a sudden surge in cpu cycles usage and/ormemory usage by the server applications. Depending on how volatile theserver applications resource usage is, this margin can be small orlarge. If the overall volatility of all virtual servers running within ahypervisor is low, then the margins can be kept small, and this willgenerally provide higher savings since more virtual servers can reliablybe run on the same physical hardware.

Many server applications are currently written in the high-levellanguage Java. Such applications are run with Java Virtual Machines(JVMs). Unfortunately the cpu-cycles and memory usage for a JVM can bequite volatile, and independent of the server application itself. Thisis due to the fact that a JVM has to garbage collect the Java heap, aswell as optimize code that has been detected as hot. These resourceusages are transient and can be significant.

Because of this, virtualized Java applications need larger safetymargins than other server applications, which means that virtualizationsavings for virtualized Java server applications are less than for otherkinds of server applications. This is an area that embodiments of thepresent invention are intended to address.

SUMMARY

Disclosed herein is a system and method for synchronizing transientresource usage between virtual machines, e.g. Java Virtual Machines(JVMs), running within a hypervisor. In accordance with an embodiment,the system allows for synchronizing garbage collection and codeoptimization to reduce transient processor (cpu) and memory usage. Inaccordance with an embodiment, the system comprises a computer; ahypervisor for executing virtual servers each running a JVM; acommunication channel between the virtual servers; wherein each virtualserver further comprises non-transient and transient memory and asynchronization module. In accordance with an embodiment thesynchronization modules schedule garbage collects and code optimizationsto minimize overlaps, thereby reducing the peak transient memory and cpuusage and the resulting volatility of transient resource usage within acomputer. In accordance with another embodiment, a cloud manager canmove virtual servers between computers to optimize computer volatilitywithin a cloud.

BRIEF DESCRIPTION OF THE FIGURES

FIG. 1 shows an illustration of a system for synchronizing transientresource usage in accordance with an embodiment.

FIG. 2 shows a graph illustrating how a garbage collection can beadvanced, in accordance with an embodiment.

FIG. 3 shows an illustration of how concurrent code optimization inseparate JVMs can be prevented using a round robin scheme, in accordancewith an embodiment.

FIG. 4 shows an illustrating of how the synchronization is achievedbetween three JVMs by advancing garbage collects and postponing codeoptimizations, in accordance with an embodiment.

FIG. 5 shows an illustration of achieved synchronization and lowvolatility in a different scale, in accordance with an embodiment.

FIG. 6 shows a flowchart of a method to synchronize the transientresource usage, in accordance with an embodiment.

FIG. 7 shows a flowchart of a method to advance garbage collects toavoid overlaps, in accordance with an embodiment.

FIG. 8 shows an illustration of how a cloud of computers can becontrolled by a cloud manager to reduce computer volatility, inaccordance with an embodiment.

FIG. 9 shows an illustration of how a cloud of computers can becontrolled by a cloud manager to reduce computer resource usage, inaccordance with an embodiment.

DETAILED DESCRIPTION

Described herein is a system and method for synchronizing transientresource usage between virtual machines, e.g. JVMs running within ahypervisor. As described herein, it is desirable to lower the resourceusage volatility of each virtual server to allow more virtual servers tobe safely run within the same hypervisor. Unfortunately JVMs have arather high volatility with garbage collects and code optimizations thatcan consume significant memory and processor (cpu) resources.

In accordance with an embodiment, a system and method is provided thatenables transient resource usage to be synchronized by advancing orpostponing the execution of processes in the different JVMs therebyavoiding peaks in transient resource usage; thus lowering the volatilityand allowing more virtual servers to be run within a single hypervisorwith the same safety margins. This is possible since garbage collectionand code optimization are processes where the former can be advanced,and the latter postponed, without significantly affecting performance ofthe running system.

It is not always possible to avoid overlapping processes. The number ofoverlapping transient processes over a fixed period of time is anindication of the overall volatility of the computer. In accordance withan embodiment, this number can be used to evaluate if a computer hasgood safety margins. In accordance with another embodiment, virtualservers can be moved between computers within a cloud to reducevolatility of servers with high volatility, and increase volatility ofservers with inefficiently low volatility. In accordance with anotherembodiment, a tailored operating system that can only run a single JVMcan reduce the volatility of a virtual server, since there are no otherpossible processes competing for resources.

FIG. 1 shows an illustration of a system in accordance with anembodiment. As shown in FIG. 1, an embodiment of the system generallycomprises a computer 100 with a hypervisor 102 on which a plurality ofvirtual servers 104, 105, 107 are running.

Each virtual server runs a JVM that needs internal memory 106, 109, 111to function. Each virtual server further includes a Java heap 108, 113,115, which is required to execute the application server code. Theinternal memory and the heap are both considered non-transient memory110, that changes size slowly, if at all.

A short-lived process, such as garbage collection, requires memory 112to execute. Other examples of short lived processes are codeoptimizations, and the memory 114 needed for it to execute. The memoryneeded for these short lived processes is considered transient memory116.

Each virtual server contains a synchronization module 118, 119, 120. Oneof these synchronization modules is selected at random to be the mastersynchronization module 120. The master synchronization module uses acommunication channel 122 to synchronize the transient resource usage ofall of the virtual servers running within the hypervisor. This can beused to, for example, prevent garbage collection and code generation indifferent virtual servers from running concurrently, and therebyreducing the peak usage of transient memory and cpu cycles.

FIG. 2 shows a graph illustrating how a garbage collection can beadvanced, in accordance with an embodiment. As shown in FIG. 2, thediagram 200 illustrates an example of how the used memory 202 of theJava heap increases over time.

Each small drop 204 in the used memory is the result of a nurserygarbage collection that is very fast and requires little cpu and memoryusage.

The large drop in used memory 206 is the result of an whole heap garbagecollection that can require a significant amount of cpu and memoryusage. The whole heap garbage collection will be forced when all theJava heap is used up at the time 208. In accordance with an embodiment,this time can be predicted with a linear approximation of the slope ofthe Java heap usage graph and extending this line until it meets theJava heap size 210. The end time of a garbage collect can be predictedto be start time plus the length of the previous garbage collect in thesame JVM.

A garbage collect can be initiated at anytime before 208, i.e. it isadvanced ahead of its natural time of execution, which is when the Javaheap is full. At time 212 the master synchronization module needs toadvance the predicted garbage collect from the time 208 to the time 214.In accordance with an embodiment it does so by sending a Start GC token216 using the communication channel 122, together with a suitabledeadline to make sure the GC happens before time 214.

FIG. 3 shows an illustration how concurrent code optimization inseparate JVMs can be prevented using a round robin scheme controlled bythe master synchronization module, in accordance with an embodiment. Asshown in FIG. 3, three optimization queues 300, 301, 303 are provided,one for each of the plurality of JVMs, wherein each queue contains alist of methods that need to be optimized for that JVM. Optimized codeis usually not shared between different JVMs since optimizationssometimes depend on runtime behavior that can differ between the JVMs.Another reason for not sharing the optimized code between different JVMsis that the optimized code also encodes several runtime references tofixed addresses only valid within that particular JVM. If optimized codewas to be moved between different JVMs these references would have to berelinked. As shown in this example, after the first JVM has optimizedthe method Buyer. toString 302, the synchronization module transfers anoptimization token 304 to the second JVM. The optimization token givesthe JVM the right to optimize a method for, at most, a certain timespecified by the optimization token, in this instance 1s. Once themethod is optimized, an optimization token can be provided to anotherJVM, and the process continues in a striping fashion across theplurality of JVMs.

Effectively every optimization at a JVM is postponed until the JVM hasreceived an optimization token. If the JVM has failed to complete theoptimization within the allotted time it must abort the optimization, asillustrated in this instance by the aborted optimization 306, and laterrestart the optimization when the JVM is later given a new optimizationtoken. The failure is reported to the synchronization module which cansend a modified optimization token 308 to the JVM that doubles thelength of the original time slot, in this instance to 2s. Thus theoptimization of MusicPurchase.sample can be subsequently restarted 310and have a higher likelihood of completion.

FIG. 4 shows an illustration of how the synchronization is achievedbetween three JVMs by advancing garbage collects and postponing codeoptimizations, in accordance with an embodiment. As shown in FIG. 4, aschedule for garbage collects and code optimizations evolvessuccessively from different instances of the schedule 400, 402, 404, 406to 408. Garbage collects are visualized as rectangles, and codeoptimizations are visualized as ellipses.

In the example shown, in a first instance of the schedule 400, at a time412, the master synchronization module has received a predicted garbagecollect 414 from JVM1 starting at time 412 and ending at time 416. Ithas also scheduled a code optimization 418. JVM 3 has predicted agarbage collect 420; and JVM 2 has predicted a collect 422.

At time 424, the master synchronization module requests new predictionsfrom the JVMs and updates the schedule from its original instance 400 toa modified instance 402. In this example, the schedule is updated withthe new predicted garbage collect 426 for JVM 1. The mastersynchronization module also detects that the predicted start time forgarbage collect 422 has moved to 428 and therefore overlaps with thecurrently predicted garbage collect 420.

To resolve this, the master synchronization module updates the schedule404, and advances the garbage collect 420 to a new time 430, which isenough to avoid overlap. It does so by sending a suitable start GC tokento JVM 3. Unfortunately the scheduled optimization 418 has to bepostponed since it cannot be started as previous optimization statisticsshow that it would not complete within the shortened time frame. It istherefore moved to a time 432.

At time 434, the master synchronization module again acquires the latestpredictions from the JVMs and can therefore update the schedule 406,408, and schedule a new optimization 436.

FIG. 5 shows an illustration of achieved synchronization and lowvolatility in a different scale, in accordance with an embodiment. Asshown in FIG. 5, the schedule 500 illustrates the actual garbagecollections and code optimizations in a scale 502 that reflects the realworld values (in this example 20 seconds). A garbage collect is againvisualized as a rectangle 504 and a code optimization is visualized asan ellipse 506. In the example shown, most of the garbage collects andthe code optimizations are non-overlapping, except for 508 where twogarbage collects are scheduled to happen at the same time, and 510 whereone garbage collect and one code optimization happen at the same time.It is worth noting that no two code optimizations are scheduled tohappen at the same time. The number of overlaps are therefore 2, whichis the volatility of the computer for a period of 20 seconds.

FIG. 6 shows a flowchart of a method to synchronize the transientresource usage, in accordance with an embodiment. As shown in FIG. 6, instep 600 the master synchronization module will wait for a notificationfrom any JVM that a garbage collect or code optimization has started orended. A JVM might also notify the master synchronization module thatthe previously reported predicted garbage collection time has changed.In step 602, the master synchronization module requests predictions ofthe start and end times for garbage collects from all the JVMs runningwithin the hypervisor. It updates the schedule accordingly. At step 604,the master synchronization module detects garbage collection overlapsand minimizes overlaps by advancing the start times of predicted garbagecollects. There can still be overlaps if a JVM is forced to garbagecollect earlier than predicted or if a garbage collect cannot beadvanced. This can happen if the application behavior suddenly changes.At step 606, the master synchronization module detects overlaps betweencode optimizations and garbage collects, if it finds any, the codeoptimizations are postponed to avoid overlaps. There can still beoverlaps if a JVM is forced to garbage collect earlier than predicted.At step 608, the master synchronization module schedules new codeoptimization using a round robin scheme. At step 610, the mastersynchronization module enters the wait state again.

FIG. 7 shows a flowchart of a method to advance garbage collects toavoid overlaps, in accordance with an embodiment. As shown in FIG. 7, instep 700 the master synchronization module iterates over each start andend point in time of each garbage collect. At each point in time, itcounts how many other garbage collects are active at that particularpoint in time. It stores the maximum number of concurrently activegarbage collections. In step 702, it is checked if the stored number iszero, since if zero then there are no overlapping garbage collectionsand the method will finish 704. If there are overlapping garbagecollects 706, then in step 708 the method calculates, for each garbagecollect, that overlaps any other, how much the garbage collect must beadvanced until the maximum number of concurrently overlapping garbagecollects is reduced. A garbage collect that, no matter how much it isadvanced cannot reduce the maximum number of concurrent garbage collectsis non-advanceable. If all garbage collects are non-advanceable 712,then the method is finished. If there are advanceable garbage collects714 then the system picks the one that requires the least amount ofadvancing 716 and advances this garbage collect. The method thenrestarts at step 700.

The method shown in FIG. 7 must eventually terminate, since at eachiteration it will reduce the maximum number of concurrent garbagecollects (step 716). If it cannot reduce the number of concurrentgarbage collects it will terminate, either at step 702 when there are nooverlapping garbage collects, or at step 710 when no improvement can bemade.

FIG. 8 shows an illustration of how a cloud of computers can becontrolled by a cloud manager to reduce computer volatility, inaccordance with an embodiment. As shown in FIG. 8, a cloud of computers800 comprises individual computers 802, 804, 806, each executing aplurality of virtual servers executing one or more JVMs 808. The JVMswithin each single computer is associated with a master synchronizationmodule 810, 812, 814 at that computer. In accordance with an embodiment,the master synchronization modules are controlled by a cloud volatilitymanager 816, which can work together with other management tools 818generally provided with such cloud environments. If a first computer 802has a high overall volatility, i.e. there are many collisions betweengarbage collects and code optimizations between the virtual serversrunning on this computer, and a second computer 804 has a low overallvolatility, then the cloud volatility manager 816 can decide to switchor change the computer hosts 824 for the virtual servers 820 and 822. Ifthe overall volatility of the computer 802 did not decrease more thanthe overall volatility of 804 increased, then the switch would bereverted. In accordance with an embodiment the switch could be precededby a check that the virtual server 820 has a more unpredictable behaviorthan the virtual server 822. This can for example be measured by thestandard deviation of the distance between garbage collects.

FIG. 9 shows an illustration of how a cloud of computers can becontrolled by a cloud manager to reduce computer resource usage, inaccordance with an embodiment. As shown in FIG. 9, a cloud of computers900 comprises individual computers 902, 904, 906, each executing aplurality of virtual servers executing one or more JVMs. Each JVM has anon-transient memory usage 908 and a transient memory usage 910. Toachieve the largest memory and cpu usage savings, it is also importantfor the cloud volatility manager to locate virtual servers with the sametransient memory and cpu usage on the same computer. Cloud 900 istherefore suboptimal since all the computers 902, 904 and 906 requirethe same large amount of transient memory. By relocating the virtualservers into a new cloud configuration 911 the maximum transient memoryusage of the server 912 is almost equivalent to the originalconfiguration 902. However the maximum transient memory usage issignificantly reduced for 914 and 916 compared to their originalconfigurations 904 and 906. In accordance with an embodiment such arelocation is based on the mean and standard deviation of the transientmemory usage of the virtual servers. Since the transient memory usage isreduced, more virtual servers can be hosted on the computers 914 and916.

The present invention may be conveniently implemented using one or moreconventional general purpose or specialized digital computer, computingdevice, machine, or microprocessor programmed according to the teachingsof the present disclosure. Appropriate software coding can readily beprepared by skilled programmers based on the teachings of the presentdisclosure, as will be apparent to those skilled in the software art.

In some embodiments, the present invention includes a computer programproduct which is a storage medium or computer-readable medium (media)having instructions stored thereon/in which can be used to program acomputer to perform any of the processes of the present invention. Thestorage medium can include, but is not limited to, any type of diskincluding floppy disks, optical discs, DVD, CD-ROMs, microdrive, andmagneto-optical disks, ROMs, RAMs, EPROMs, EEPROMs, DRAMs, VRAMs, flashmemory devices, magnetic or optical cards, nanosystems (includingmolecular memory ICs), or any type of media or device suitable forstoring instructions and/or data.

The foregoing description of the present invention has been provided forthe purposes of illustration and description. It is not intended to beexhaustive or to limit the invention to the precise forms disclosed.Many modifications and variations will be apparent to the practitionerskilled in the art. The embodiments were chosen and described in orderto best explain the principles of the invention and its practicalapplication, thereby enabling others skilled in the art to understandthe invention for various embodiments and with various modificationsthat are suited to the particular use contemplated. It is intended thatthe scope of the invention be defined by the following claims and theirequivalence.

1. A system for synchronizing transient resource usage between virtualservers, comprising: one or more computers, wherein each of the one ormore computers includes one or more virtual servers, wherein each of theone or more virtual servers is associated with a synchronization module,and a communication channel, that enables communication between thevirtual servers; wherein the computers can be provided within a cloud ofcomputers; and wherein the virtual servers use their associatedsynchronization module and the communication channel to synchronizetransient resource usage between the plurality of virtual servers,including advancing or postponing execution of processes runningthereon.
 2. The system of claim 1, wherein each virtual server runs oneor more Java Virtual Machines (JVMs).
 3. The system of claim 1, whereinone or more of the virtual servers has an operating system tailored toonly run a single JVM, and to reduce volatility of the single JVM. 4.The system of claim 1, wherein each virtual server includes anon-transient memory space or heap, for storage and execution ofrelatively longer-lived processes; and a transient memory space or heap,for storage and execution of relatively shorter-lived processes.
 5. Thesystem of claim 4, wherein the transient memory is memory used forgarbage collection processes.
 6. The system of claim 4, wherein thetransient memory is memory used for code optimization processes.
 7. Thesystem of claim 1, wherein each synchronization module determinespredictions of times of garbage collects, code optimizations, or otherprocesses at its associated virtual server.
 8. The system of claim 7,wherein the transient memory is used for garbage collection processes,and wherein the synchronization module advances garbage collects toavoid overlaps with other garbage collects.
 9. The system of claim 7,wherein the transient memory is used for code optimization processes,and wherein the synchronization module postpones code optimizations toavoid overlaps with garbage collects and other code optimizations. 10.The system of claim 7, wherein each of the plurality of virtual serversfurther comprises a synchronization module, and wherein one of thesynchronization modules is selected as a master synchronization module,wherein the master synchronization module requests predictions from thesynchronization modules at the other virtual servers, and uses thepredictions to update a schedule of garbage collects, codeoptimizations, or other processes, from an original schedule to amodified schedule.
 11. The system of claim 7, wherein eachsynchronization module uses the communication channel to communicateinformation between the plurality of virtual servers, and to synchronizetransient resource usage between the virtual servers.
 12. The system ofclaim 7, wherein each synchronization module performs the steps of:waiting for a notification from a virtual server, requesting garbagecollection predictions from other virtual servers, detecting andminimizing the number of garbage collection overlaps by advancinggarbage collects as necessary, detecting and minimizing the number ofcode optimization overlaps by postponing code optimizations asnecessary, and scheduling garbage collects, code optimizations, or otherprocesses to synchronize transient resource usage between the pluralityof virtual servers.
 13. The system of claim 1, wherein the one or morecomputers includes a hypervisor running thereon, for executing the oneor more virtual servers.
 14. The system of claim 1, wherein the systemis used as a component for controlling the volatility of a cloud ofvirtual servers, and wherein the system further comprises: a cloudvolatility manager that monitors the volatility of computers within thecloud; a plurality of computers participating in the cloud, each ofwhich one or more computers further includes virtual servers withmeasured resource usage volatility, and configured to synchronizetransient resource usage between the plurality of virtual servers; andwherein the cloud volatility manager can switch or move virtual serversfrom a first of the plurality of computers participating in the cloud,to a second of the plurality of computers participating in the cloud, toimprove volatility in the cloud.
 15. A method of synchronizing transientresource usage between virtual servers, comprising the steps of:providing at one or more computers, one or more virtual servers, whereineach of the one or more virtual servers is associated with asynchronization module, and a communication channel, that enablescommunication between the virtual servers; wherein the computers can beprovided within a cloud of computers; and wherein the virtual serversuse their associated synchronization module and the communicationchannel to synchronize transient resource usage between the plurality ofvirtual servers, including advancing or postponing execution ofprocesses running thereon.
 16. A computer readable medium, includinginstructions stored thereon which, when read and executed by one or morecomputers, causes the one or more computers to perform the methodcomprising the steps of: providing at one or more computers, one or morevirtual servers, wherein each of the one or more virtual servers isassociated with a synchronization module, and a communication channel,that enables communication between the virtual servers; wherein thecomputers can be provided within a cloud of computers; and wherein thevirtual servers use their associated synchronization module and thecommunication channel to synchronize transient resource usage betweenthe plurality of virtual servers, including advancing or postponingexecution of processes running thereon.